function getStyle(obj,attr)
{
	return obj.currentStyle? obj.currentStyle[attr] : getComputedStyle(obj)[attr];
}

function startMove(obj,json,speed2,fnEnd)
{
	clearInterval(obj.timer);
	obj.timer = setInterval(function()
	{
		var bStop=true;
		for(var attr in json)
		{
			var cur = 0;
			if(attr=='opacity')
			{
				cur=Math.round(parseFloat(getStyle(obj,attr))*100);
			}
			else
			{
				cur = parseInt(getStyle(obj,attr));
			}
			
			var speed=(json[attr]-cur)/speed2;
			speed=speed>0?Math.ceil(speed):Math.floor(speed);
			
			if(cur!=json[attr]){bStop=false;}

			if(attr=='opacity')
			{
				obj.style.filter='alpha(opacity:'+(cur+speed)+')';
				obj.style.opacity=(cur+speed)/100;
			}
			else
			{
				obj.style[attr]=cur+speed+'px';
			}
		}
		if(bStop)
		{
			clearInterval(obj.timer);
			if(fnEnd)fnEnd();
		}
	},30);
}


function getClassName(obj,sName)
{
	if(document.getElementsByClassName) 		
	{
		return obj.getElementsByClassName(sName);
	}
	else
	{
		var aTmp = obj.getElementsByTagName('*');
		var aRes=[];
		var arr =[];
		for(var i=0;i<aTmp.length;i++)
		{
			arr = aTmp[i].className.split(' ');
			for (var j=0;j<arr.length;j++)
			{
				if(arr[j] == sName)
				{
					aRes.push(aTmp[i]);
				}
			}
		}
		return aRes;
	}
}
function insertAfter(newElement,targetElement)  
{  
    var parent = targetElement.parentNode;  
    if(parent.lastChild == targetElement)  
    {  
        parent.insertBefore(newElement);  
     }  
    else  
    {  
        parent.insertBefore(newElement,targetElement.nextSibling);  
    }  
}